/* Copyright (c) 2025 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef __MEASUREMENT_SET_H__
#define __MEASUREMENT_SET_H__

#include "common.h"
#include "measurement.h"

#define DEFAULT_SPECIFICATION "DMTF"
#define DEFAULT_SUMMARY_TPYE  "TCB"

#define MAX_MEASUREMENT_COUNT (255)

class MeasurementSet {
public:
    string specification;
    string summaryType;
    string summaryHashAlgorithm;
    string summaryHash;
    uint8_t measurementCount;
    map<uint8_t, unique_ptr<Measurement>> measurements = {};

    MeasurementSet(const string& specification, const string& summaryType, const string& summaryHashAlgorithm);
    ~MeasurementSet() = default;

    int32_t GetMeasurementSet(void *spdm_context, uint8_t slot_id);
    int32_t GetSubMeasurements(void *spdm_context, const string& hash_algo, uint8_t slot_id);
    tuple<string, string, string, string, string> GetSignedMeasurement(void *spdm_context, vector<uint8_t> indices,
        uint8_t slot_id, const string& nonce);
};

#endif // __MEASUREMENT_SET_H__